import {
	request
} from "@/utils/request.js";

import api from "@/config/api.js";

/**
 * 发送验证码
 * @param  mobile
 */
export function sendMobile(params) {
	return request({
		url: `/api/sms/send`,
		method: "POST",
		params,
	});
}

/**
 * 短信登录
 * @param  mobile
 * @param  smsCode
 */
export function smsLogin(params, clientType) {
	return request({
		url: `/api/user/smsCheckIn`,
		method: "POST",
		params,
		header: {
			"content-type": "application/x-www-form-urlencoded",
			clientType: clientType,
		},
	});
}

// 登出
export function logout() {
	return request({
		url: '/api/user/logout',
		method: "POST",
		needToken: true,
	})
}

// 获取微信OpenID
export function getWechatOpenId(params) {
	return request({
		url: '/api/user/getWechatOpenId',
		method: "POST",
		params
	})
}


// 获取支付宝用户ID
export function getAlipayUserId(params) {
	return request({
		url: '/api/user/getAlipayUserId',
		method: "POST",
		params
	})
}

// 支付宝小程序登录
export function alipayLogin(params) {
	return request({
		url: '/api/user/alipayLogin',
		method: "POST",
		params
	})
}

// 支付宝手机号绑定
export function alipayBindPhone(params) {
	return request({
		url: '/api/user/alipayBindPhone',
		method: "POST",
		params
	})
}

// 微信小程序登录
export function wechatLogin(params) {
	return request({
		url: '/api/user/wechatLogin',
		method: "POST",
		params
	})
}

// 微信手机号绑定
export function wechatBindPhone(params) {
	return request({
		url: '/api/user/wechatBindPhone',
		method: "POST",
		params
	})
}